#include<stdio.h>
int main()
{
	int n,m,i;
	while (1)
	{
		scanf("%d",&n);
		if (n==0) break;
		for (m=0;n>1;m++)
    	    if (n%2!=0) n=n/2+1;
			else n=n/2;
		printf("%d\n",m);
    }
	return 0;
 } 

